package brcl.config;

import brcl.annotation.ApiDoc;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;


/**
 * TODO(一句话描述该类的功能，以英文句号结尾)
 *
 * @version v1.0
 * @className: SwaggerConfig
 * @author: heyiheng
 * @date: 2021-04-16 16:48
 */
@Configuration
@EnableSwagger2
public class SwaggerConfig {

	@Bean
	public Docket createPcRestApi() {
		return new Docket(DocumentationType.SWAGGER_2)
				.useDefaultResponseMessages(false)
				.apiInfo(apiInfo())
				.groupName("HVM智能合约Invoke接口文档")
				.select()
				.apis(RequestHandlerSelectors.withMethodAnnotation(ApiDoc.class))
				.paths(PathSelectors.any())
				.build();
	}

	private ApiInfo apiInfo() {
		Contact contact = new Contact("贺怡衡", "", "lope1024@163.com");
		return new ApiInfoBuilder()
				.title("HVM智能合约API接口文档")
				.contact(contact)
				.version("1.0")
				.description("API描述")
				.build();
	}

}
